package com.cgx.vo.websocket;

import com.cgx.entity.message.Message;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * @author chenguanxin
 * @date 2021-05-25 21:24
 */
@Data
public class MessageVo implements Serializable {
    private String processId;
    private String messageId;
    private String sessionId;
    private String fromUserId;
    private String fromUserName;
    private String fromUserAvatarUrl;
    private Integer type;
    private String content;
    private Date time;

    public static MessageVo changeMessageVo(Message message) {
        MessageVo messageVo = new MessageVo();
        messageVo.setMessageId(message.getMessageId());
        messageVo.setSessionId(message.getSessionId());
        messageVo.setFromUserId(message.getFromUserId());
        messageVo.setType(message.getType());
        messageVo.setContent(message.getContent());
        messageVo.setTime(message.getCreateTime());
        return messageVo;
    }
}
